package org.example;

public class Test4 {
    //letcode 367 有效的完全平方数 https://leetcode.cn/problems/valid-perfect-square/submissions/535719781/
    public boolean isPerfectSquare(int num) {
        long left = 0, right = num, mid = 0;
        while (left < right) {
            mid = left + (right - left) / 2;
            if (mid * mid < num) {
                left = mid + 1;
            }else {
                right = mid;
            }
        }
        return left * left == num;
    }
}
